from basic.device.Android import Android


class messagePage(Android):

    # 动态消息title
    title = "com.cloudbae.lovenanning:id/tv_dynamic_title"
    # 消息列表为空
    empty = "com.cloudbae.lovenanning:id/empty_show_text"



    # 点击动态
    @classmethod
    def clickMessage(self):
        self.poco(text="动态").click()

    # 点击城市消息
    @classmethod
    def clickCity(self):
        self.poco(text="城市消息").click()

    # 获取消息，标题
    @classmethod
    def getTitle(self):
        listTitle = self.poco(self.title)
        lenTitle = len(listTitle)

        # 空数组存放title
        titleText = []
        for i in range(0, lenTitle):
            titleText.append(listTitle[i].get_text())
        print(titleText)
        if lenTitle > 0:
            return True



    # 列表有无数据
    @classmethod
    def ifEmpty(self):
        Text = self.poco(self.empty)
        if Text.exists():
            a = Text.get_text()
            print(a)
            return True
        else:
            return False


